package com.ar.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.text.Html;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ResultAdapter extends BaseAdapter {
	private Context mContext;
	private ArrayList<String> alResult;
	
	public ResultAdapter(Context context, ArrayList<String> alResult){
		this.mContext = context;
		this.alResult = alResult;
	}
	
	@Override
	public int getCount() {
		return alResult.size();
	}

	@Override
	public TextView getItem(int arg0) {
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		TextView tvItem;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
        	tvItem = new TextView(mContext);
        	tvItem.setPadding(4, 4, 4, 4);
        	tvItem.setTextSize(TypedValue.COMPLEX_UNIT_PT, 10);
        	
        } else {
        	tvItem = (TextView) convertView;
        }
        tvItem.setText(Html.fromHtml(alResult.get(position)));
        return tvItem;
	}
	
}
